linux 端口的查看:netstat nmap

葫芦的运维日志

下一篇 搜索 上一篇

浏览量 4648

2014/01/21 16:26


yum install nmap
查看本局域网内有多少台主机在运行
nmap -sP 192.168.0.0/24
****
*****
...
Host 192.168.0.253 appears to be up.
MAC Address: 00:17:61:DF:0D:D5 (ZKSoftware)
Host 192.168.0.254 appears to be up.
MAC Address: 00:17:61:7C:08:18 (ZKSoftware)
Nmap finished: 256 IP addresses (70 hosts up) scanned in 27.207 seconds
查看本机的tcp和udp开放的协议及端口
root@localhost ~]# nmap -sTU localhost

Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2014-01-24 11:40 CST
Interesting ports on localhost.localdomain (127.0.0.1):
Not shown: 3157 closed ports
PORT     STATE         SERVICE
22/tcp   open          ssh
25/tcp   open          smtp
80/tcp   open          http
111/tcp  open          rpcbind
800/tcp  open          mdbs_daemon
916/tcp  open          unknown
3306/tcp open          mysql
111/udp  open|filtered rpcbind
910/udp  open|filtered unknown
913/udp  open|filtered unknown

Nmap finished: 1 IP address (1 host up) scanned in 1.300 seconds
查看本机开放了那些tcp协议
[root@localhost ~]# nmap localhost

Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2014-01-24 11:40 CST
Interesting ports on localhost.localdomain (127.0.0.1):
Not shown: 1673 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
25/tcp   open  smtp
80/tcp   open  http
111/tcp  open  rpcbind
800/tcp  open  mdbs_daemon
916/tcp  open  unknown
3306/tcp open  mysql

查看某台主机的开放了哪些协议
root@localhost ~]# nmap  192.168.0.253

Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2014-01-24 11:41 CST
Interesting ports on 192.168.0.253:
Not shown: 1679 closed ports
PORT   STATE SERVICE
23/tcp open  telnet
MAC Address: 00:17:61:DF:0D:D5 (ZKSoftware)

Nmap finished: 1 IP address (1 host up) scanned in 1.807 seconds

列出正在监听的网络服务
[root@localhost ~]# netstat -tunl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State     
tcp        0      0 0.0.0.0:800                 0.0.0.0:*                   LISTEN     
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN     
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN     
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN     
tcp        0      0 0.0.0.0:916                 0.0.0.0:*                   LISTEN     
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN     
tcp        0      0 0.0.0.0:23                  0.0.0.0:*                   LISTEN     
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN     
tcp        0      0 :::22                       :::*                        LISTEN     
udp        0      0 0.0.0.0:910                 0.0.0.0:*                              
udp        0      0 0.0.0.0:913                 0.0.0.0:*                              
udp        0      0 0.0.0.0:36562               0.0.0.0:*                              
udp        0      0 0.0.0.0:5353                0.0.0.0:*                              
udp        0      0 0.0.0.0:111                 0.0.0.0:*                              
udp        0      0 :::58313                    :::*                                   
udp        0      0 :::5353                     :::* 
列出已连接的网络的链接状态
[root@localhost ~]# netstat -tun
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State     
tcp        0      0 192.168.0.166:22            192.168.0.70:49979          ESTABLISHED 
 

 

葫芦的运维日志

打赏

上一篇 搜索 下一篇
© 冰糖葫芦甜(bthlt.com) 2021 王梓打赏联系方式 陕ICP备17005322号-1